<?php
/**
 * IMMOPHP
 * @desc permet edition de bloc
 * @autor Drouche Romain
 * */
require 'kernel/common.php';

if(!$Session->check_admin()) redirect('index.php');

if(!$id = retrieve('GET', 'bloc', true)) redirect('bloc.php?error=retrieve');

require_once IMMOPHP_ADMIN_ROOT_PATH.'kernel/Bloc.class.php';

$Bloc = new Bloc($paramClass);

$Bloc->getBloc($id);

$smarty->assign('lang', $lang);
$smarty->assign('bloc', $Bloc->bloc);
$smarty->assign('token', $Session->_session['token']);
$smarty->assign('emplacement_array', $Bloc->getEmplacementArray() );

if($Bloc->bloc['contenu'] != '')
{
    $smarty->assign('contenu', get_ckeditor('contenu',stripslashes($Bloc->bloc['contenu'])) );
    
    $smarty->display('bloc_edition_html.tpl');
}
else
{
    $smarty->display('bloc_edition.tpl');
}

require_once 'footer.php';
?>